# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1521 -> 1.1522 # drivers/serial/serial_core.c 1.72 -> 1.73 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/10/16 bjorn.helgaas@hp.com 1.1522 # [PATCH] serial console registration bugfix # # uart_set_options() can dereference a null pointer. This happens # if you specify a console that hasn't previously been setup by # early_serial_setup(). # # For example, on ia64, the HCDP typically tells us about line 0, # so we calls early_serial_setup() for it. If the user specifies # "console=ttyS3", we machine-check when trying to follow the # uninitialized port->ops pointer. # # It's not entirely clear to me whether we should return 0 or -ENODEV # or something. The advantage of returning zero is that if the user # specifies "console=ttyS0" and we just lack the HCDP, the console # doesn't work as early as usual, but it does start working after the # serial driver detects the port (though the baud/parity/etc from the # command line are lost). Returning -ENODEV seems to prevent it from # ever working. # -------------------------------------------- # diff -Nru a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c --- a/drivers/serial/serial_core.c Fri Oct 17 00:38:29 2003 +++ b/drivers/serial/serial_core.c Fri Oct 17 00:38:29 2003 @@ -1859,6 +1859,9 @@ if (flow == 'r') termios.c_cflag |= CRTSCTS; + if (!port->ops) + return 0; + port->ops->set_termios(port, &termios, NULL); co->cflag = termios.c_cflag;